package com.itheima.streamdemo.mystream;

import java.util.ArrayList;

public class MyStream5 {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 1; i <= 10; i++) {
            list.add(i);
        }

        /*
         *      list.stream(); 将集合的数据copy一份出来,放到流中.
         *      后续对流中的数据改动,不会影响原有集合的数据
         */
        list.stream().filter(number -> number % 2 == 0).forEach(number -> System.out.println(number));
        System.out.println("====================");
        list.forEach(number -> System.out.println(number));
    }
}
